<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>选择后关闭</title>
		<link href="../select3.css" rel="stylesheet" />
	</head>

	<body>
		<!--表单包裹层-->
		<div style="width: 360px; margin: 10px;">
			<div class="select3-ui" id="xxx" data-value='23'data-source='{"nodes": [{"text":"重庆", "value":"23"}]}'></div>
		</div>
		<!--表单包裹层-->
		<div style="width: 360px; margin: 10px;">
			<div class="select3-ui" id="yyy" data-value='010,023'></div>
		</div>
		<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
		<script type="text/javascript" src="../select3.js" ></script>
		<script>
		var data1 = {
					"nodes": [{
						"text": "重庆市",
						"value": "23",
						"selected": false,
						"nodes": null
					}, {
						"text": "北京市",
						"value": "010",
						"selected": false,
						"nodes": null
					}, {
						"text": "四川",
						"value": "028",
						"selected": false,
						"nodes": [{
								"text": "成都市",
								"value": "03001",
								"selected": false,
								"nodes": null
							}, {
								"text": "宜宾市",
								"value": "03002",
								"selected": false,
								"nodes": [{
									"text": "翠屏区",
									"value": "0300201",
									"selected": false
								}]
							}]
						}]
					};
		var data2 = {"nodes": [{
					"text": "重庆市",
					"value": "023",
					"selected": false,
					"nodes": null
						}, 
					{
						"text": "北京市",
						"value": "010",
						"selected": false,
						"nodes": null
					}]
		};
		var data3 = {"nodes": [{
						"text": "重庆市",
						"value": "023",
						"selected": false,
						"nodes": null
					}]
		};
			var selectxxx = $("#xxx").select3(
			{
				mode: 'local',
				placeholder: '请选择城市',
				multiple:false,//是否可以多选
				selectParent:true,//是否可以选择父节点
				duplicate:false,//是否可以重复选
				countdownSearch: true,//倒计时搜索
				countdownTime:500,//倒计时时间单位毫秒
				debug:true
			},
			"xxxxx",
			function(instance){
				instance.setDataSource(data1);
			});
			
			$("#yyy").select3(
			{
				mode: 'local',
				placeholder: '请选择城市',
				multiple:true,//是否可以多选
				selectParent:true,//是否可以选择父节点
				duplicate:false,//是否可以重复选
				countdownSearch: true,//倒计时搜索
				countdownTime:500,//倒计时时间单位毫秒
				debug:true
			},
			"yyyy",
			function(){
				instance.setDataSource(data2);
			},
			function(instance, code){
				instance.setSelectedValue(code, data2);
			}
			);
		</script>
	</body>
</html>
				